/*
 * @Date: 2022-03-01 14:44:58
 * @Author: 陶子
 * @LastEditTime: 2022-07-11 16:01:08
 * @FilePath: \jk_one-stop_pc\src\views\workManagement\productTask\allColumn.js
 * @pageName: 这是--(生产任务配置列)--页面
 */
import { APILX } from '@/api/requestLx'

export let columns = [
  {
    title: '报工数量',
    dataIndex: 'reportNum',
    ellipsis: true,
    width: 200,
    scopedSlots: { customRender: 'reportNum' },
  },
  {
    title: '合格数',
    dataIndex: 'qualifiedNum',
    ellipsis: true,
    width: 200,
    scopedSlots: { customRender: 'qualifiedNum' },
  },
  {
    title: '不合格数',
    align: 'left',
    dataIndex: 'unqualifiedNum',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      customRender: 'unqualifiedNum',
    },
  },
  {
    title: '计件单价',
    dataIndex: 'pieceRate',
    ellipsis: true,
    width: 200,
    scopedSlots: { customRender: 'pieceRate' },
  },
  {
    title: '计件工资',
    dataIndex: 'totalSalary',
    ellipsis: true,
    width: 200,
    scopedSlots: { customRender: 'totalSalary' },
  },
  {
    title: '操作人',
    align: 'left',
    dataIndex: 'userText',
    ellipsis: true,
    width: 200,
    searchIndex: 'userId',
    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'dateIcon',
      customRender: 'userText',
    },
  },
  {
    title: '工序名称',
    dataIndex: 'processesName',
    ellipsis: true,
    width: 200,
    options: [],
    multi: true,
    searchIndex: 'processesIds',
    scopedSlots: { customRender: 'processesName', filterDropdown: 'selectDropdown', filterIcon: 'selectIcon' },
  },
  {
    title: '工单编号',
    align: 'left',
    dataIndex: 'orderCode',
    ellipsis: true,
    width: 200,
    searchIndex: 'orderCode',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'orderCode',
    },
  },

  {
    title: '物品编号',
    align: 'left',
    dataIndex: 'serialNumber',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialNumber',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialNumber',
    },
  },
  {
    title: '物品名称',
    align: 'left',
    dataIndex: 'serialName',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialName',

    scopedSlots: { customRender: 'serialName', filterDropdown: 'searchDropdown', filterIcon: 'searchIcon' },
  },
  {
    title: '规格',
    align: 'left',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialSpecifications',

    scopedSlots: { customRender: 'serialSpecifications', filterDropdown: 'searchDropdown', filterIcon: 'searchIcon' },
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'unitName' },
  },

  {
    title: '任务时间',
    align: 'left',
    dataIndex: 'timePeriod',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      customRender: 'timePeriod',
    },
  },
  {
    title: '关联订单',
    align: 'left',
    dataIndex: 'sellOrderCode',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'sellOrderCode' },
  },
  {
    title: '报工时间',
    align: 'left',
    dataIndex: 'reportTime',
    sorter: true,
    ellipsis: true,
    width: 200,

    scopedSlots: {
      customRender: 'reportTime',
    },
  },

  {
    title: '创建时间',
    align: 'left',
    dataIndex: 'createTime',
    sorter: true,
    ellipsis: true,
    width: 200,
    searchIndex: 'createTime',
    scopedSlots: {
      // filterDropdown: 'datePickercreateTime',
      // filterIcon: 'dateIcon',
      // customRender: 'createTime',
    },
  },
  {
    title: '更新时间',
    align: 'left',
    dataIndex: 'updateTime',
    sorter: true,
    ellipsis: true,
    width: 200,
    searchIndex: 'updateTime',
    scopedSlots: {
      // filterDropdown: 'datePickerupdateTime',
      // filterIcon: 'dateIcon',
      // customRender: 'updateTime',
    },
  },
  {
    title: '创建人',
    align: 'left',
    dataIndex: 'createByText',

    ellipsis: true,
    width: 200,
    searchIndex: 'createBy',

    scopedSlots: {
      filterDropdown: 'createBy',
      filterIcon: 'dateIcon',
      customRender: 'createByText',
    },
  },
  {
    title: '更新人',
    align: 'left',
    dataIndex: 'updateByText',
    ellipsis: true,
    width: 200,
    searchIndex: 'updateBy',
    scopedSlots: {
      filterDropdown: 'updateBy',
      filterIcon: 'dateIcon',
      customRender: 'updateByText',
    },
  },
]
export let allColumn = [...columns]
export let columnshand = [
  {
    title: '工单编号',
    dataIndex: 'orderCode',
    ellipsis: true,
    align: 'left',
    fixed: 'left',
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'searchIcon',
      customRender: 'orderCode',
    },
  },
  {
    title: '物品编号',
    dataIndex: 'serialNumber',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialNumber',
    },
  },
  {
    title: '物品名称',
    dataIndex: 'serialName',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialName',
    },
  },
  {
    title: '规格',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialSpecifications',
    },
  },
  {
    title: '状态',
    dataIndex: 'orderStatus',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'selectIcon',
      customRender: 'orderStatus',
    },
  },
  {
    title: '生产进度',
    dataIndex: 'orderStatusList',
    ellipsis: true,
    width: 200,
    scopedSlots: {},
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    width: 200,
    scopedSlots: {},
  },
  {
    title: '计划生产数量',
    dataIndex: 'planProduceNum',
    ellipsis: true,
    width: 200,
    scopedSlots: {},
  },
  {
    title: '计划时间',
    dataIndex: 'planStartTime',
    ellipsis: true,
    width: 200,
    scopedSlots: {},
  },
  // {
  //   title: '已生产数量',
  //   dataIndex: 'goodsName',
  //   ellipsis: true,
  //   width: 200,
  // },
  // {
  //   title: '已生产数量',
  //   dataIndex: 'sellOrderCode',
  //   ellipsis: true,
  //   width: 200,
  // },
  // {
  //   title: '关联订单',
  //   dataIndex: 'sellOrderCode',
  //   ellipsis: true,
  //   width: 200,
  // },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    ellipsis: true,
    width: 200,
    sorter: true,
    scopedSlots: {
      // filterDropdown: 'selectDropdown',
      // filterIcon: 'searchIcon',
      // customRender: 'createTime',
    },
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    ellipsis: true,
    width: 200,
    sorter: true,
    scopedSlots: {
      // filterDropdown: 'selectDropdown',
      // filterIcon: 'searchIcon',
      // customRender: 'updateTime',
    },
  },
  {
    title: '创建人',
    dataIndex: 'createBy',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'peopleIcon',
      customRender: 'createBy',
    },
  },
  {
    title: '更新人',
    dataIndex: 'updateBy',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectPeople',
      filterIcon: 'peopleIcon',
      customRender: 'updateBy',
    },
  },
]
export function getTypeList() {
  let param = {
    pageNo: 1,
    pageSize: 9999,
  }
  APILX.ProcessesList(param).then((res) => {
    console.log(res, 'ressss')
    let newArrApply = res.result.records.map((item) => {
      return {
        label: item.processesName,
        key: item.id,
      }
    })
    columns[4].options = newArrApply
    allColumn[4].options = newArrApply
  })
}
